In ActionScript 3, constructor code is always interpreted rather than compiled by the JIT at runtime, which is why the body of a constructor should
be as lightweight as possible. As soon as a constructor contains branches ("if", "for", "switch", …) an issue is logged.
Noncompliant code example
public class Foo
{
public function Foo()
{
if (condition) { // Noncompliant
// ...
}
}
}
Compliant solution
public class Foo
{
public function Foo()
{
init()
}
private function init():void
{
if (condition) {
// ...
}
}
}